package Practice.Practice_02.UserManagementSystem;

import java.util.Scanner;

public class DeleteUser {
    public static void delete(Person[] person, int index) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入要删除用户的ID号码");
        int id = sc.nextInt();
        if(person[index].getId() == id){
            System.out.println("不能删除当前的用户");
            return;
        }
        for(int i = 0; i < person.length; i++){
            if(person[i].getId() == id){
                person[i].setId(-1);
                person[i].setName("-1");
                person[i].setPass("-1");
                person[i].setEmail("-1");
                person[i].setPower("-1");
                break;
            }
        }
        System.out.println("删除用户成功");
    }
}
